home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / viewers / polyview / polyvw31.lha / Polyview3.1 / new / pv.h < prev    next >
C/C++ Source or Header  |  1993-08-13  |  17KB  |  558 lines

  1. /*****************************************************************************
  2.  * NCSA Polyview 3.1                                                         *
  3.  *                                                                           *
  4.  * Version 3.1 changes and additions by Gilles Bourhis.                      *
  5.  * Version 3 features and fixes by Marc Andreessen.                          *
  6.  * Version 2 by Brian Calvert.                                               *
  7.  *                                                                           *
  8.  * Software Development Group                                                *
  9.  * National Center for Supercomputing Applications                           *
  10.  * University of Illinois at Urbana-Champaign                                *
  11.  *                                                                           *
  12.  * Please send bug reports to polyview@ncsa.uiuc.edu.                        *
  13.  *                                                                           *
  14.  * Copyright (c) 1992 The Board of Trustees of the University of Illinois.   *
  15.  *                                                                           *
  16.  * This NCSA software, both binary and source, is copyrighted, but           *
  17.  * available without fee for education, academic research and                *
  18.  * non-commercial purposes.  The software is copyrighted in the name of      *
  19.  * the University of Illinois, and ownership of the software remains with    *
  20.  * the University of Illinois.  Users may distribute the binary and          *
  21.  * source code to third parties provided that the copyright notice and       *
  22.  * this statement appears on all copies and that no charge is made for       *
  23.  * such copies.  Any entity wishing to integrate all or part of the          *
  24.  * source code into a product for commercial use or resale, should           *
  25.  * contact the University of Illinois, c/o NCSA, to negotiate an             *
  26.  * appropriate license for such commercial use.                              *
  27.  *                                                                           *
  28.  * THE UNIVERSITY OF ILLINOIS MAKES NO REPRESENTATIONS ABOUT THE             *
  29.  * SUITABILITY OF THE SOFTWARE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS"      *
  30.  * WITHOUT EXPRESS OR IMPLIED WARRANTY.  THE UNIVERSITY OF ILLINOIS SHALL    *
  31.  * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE USER OF THIS SOFTWARE.      *
  32.  * The software may have been developed under agreements between the         *
  33.  * University of Illinois and the Federal Government which entitle the       *
  34.  * Government to certain rights.                                             *
  35.  *                                                                           *
  36.  * By copying this program, you, the user, agree to abide by the             *
  37.  * copyright conditions and understandings.                                  *
  38.  *****************************************************************************/
  39.  
  40. /* $Id: pv.h,v 1.4 93/08/13 12:56:20 gbourhis Exp $ */
  41.  
  42. #ifdef RCSLOG
  43. $Log:    pv.h,v $
  44.  * Revision 1.4  93/08/13  12:56:20  gbourhis
  45.  * Add TRANSaddCommand() macro for transcript.
  46.  * 
  47.  * Revision 1.3  93/07/13  16:32:31  gbourhis
  48.  * Real PVFREE
  49.  * 
  50.  * Revision 1.2  93/06/24  16:35:28  gbourhis
  51.  * new copyright on top of file.
  52.  * 
  53.  * Revision 1.1  1992/09/18  10:55:26  marca
  54.  * Initial revision
  55.  *
  56. #endif
  57.  
  58. #ifndef __POLYVIEW_PV_H__
  59. #define __POLYVIEW_PV_H__
  60.  
  61. /* SYSTEM INCLUDE FILES */
  62. #include <stdio.h>
  63. #include <sys/types.h>
  64. #include <limits.h>
  65. #include <values.h>
  66. #include <stdarg.h>
  67. #include <stdlib.h>
  68. #include <string.h>
  69. #include <math.h>
  70. #include <assert.h>
  71.  
  72. /* This should only be included if SGI's libmalloc.a is used. */
  73. #ifdef __sgi
  74. #include <malloc.h>
  75. #endif
  76.  
  77. /* This will include the Xmx, Xm, Xt, and X includes.
  78.    Wasteful wasteful wasteful. */
  79. #include "Xmx.h"
  80. #include <Xm/Command.h>
  81.  
  82. /* GRAPHICS INCLUDE FILES */
  83. #include <gl/gl.h>
  84. /* device.h should never be needed. */
  85. /* #include <gl/device.h> */
  86. /* SGI GL X-related include. */
  87. #ifdef __sgi
  88. #include <gl/glws.h>
  89. #endif
  90.  
  91. #ifdef _IBMR2
  92. #include "/usr/lpp/GL/utilities/inc/Glib.h"
  93. #endif
  94.  
  95. /* Include polyview-specific includes. */
  96. #include <df.h>
  97. #include <vg.h>
  98. #include <dtm.h>
  99.  
  100. #ifdef _IBMR2
  101. #define fhypot hypot
  102. #define facos  acos
  103. #define fasin  asin
  104. #define fatan2 atan2
  105. #define fcos   cos
  106. #define fsin   sin
  107. #define ftan   tan
  108. #define fexp   exp
  109. #define flog   log
  110. #endif
  111.  
  112. /* STATUS CONSTANTS */
  113. #define ST_ERROR    0xdeadbeef
  114. #define ST_OKAY        0xdabadaba
  115. #define ST_EMPTYSTRING    0xffffaaaa
  116.  
  117.  
  118. #define    X    0
  119. #define    Y    1
  120. #define    Z    2
  121. #define    PHI    0
  122. #define    THETA    1
  123. #define    RHO    2
  124. #define    DIMS    3
  125.  
  126. #define FROM        0
  127. #define AT        1
  128.  
  129. #define    CARTESIAN    0
  130. #define    SPHERICAL    1
  131.  
  132. #define    NONE        (0)
  133. #define FOCUSPOINT    (1<<0)
  134. #define BOXSHADED    (1<<1)
  135. #define BOXWIRE        (1<<2)
  136. #define BOXSELECTED    (1<<3)
  137. #define AXESSMALL    (1<<4)
  138. #define AXESLARGE    (1<<5)
  139. #define    TOGGLE        (1<<6)
  140.  
  141. #define    GRIDXY        (1<<7)
  142. #define    GRIDXZ        (1<<8)
  143. #define    GRIDYZ        (1<<9)
  144. #define    GRIDALL        (GRIDXY|GRIDXZ|GRIDYZ)
  145.  
  146. #define    SCATXY        (1<<10)
  147. #define    SCATXZ        (1<<11)
  148. #define    SCATYZ        (1<<12)
  149. #define    SCATALL        (SCATXY|SCATXZ|SCATYZ)
  150. #define    ALL        (~NONE)
  151.  
  152. #define    SIMPLELIGHT    2
  153. #define DEPTHCUE    3
  154.  
  155. #define    PERSPECTIVE    0
  156. #define ORTHOGRAPHIC    1
  157.  
  158. #define POINTS        0
  159. #define LINES        1
  160. #define POLYGONS    2
  161.  
  162. /* Window types */
  163. #define STATUS        0
  164. #define PALETTE        1
  165. #define PROBE        2
  166. #define BROWSER        3
  167. #define    POLYVIEW    4
  168. #define ISOVIEW        5
  169. #define PIXELVIEW    6
  170. #define VOXELVIEW    7
  171. #define GLYPHVIEW    8
  172. #define    DIALOG        9
  173.  
  174. #define    PVSHORT        0
  175. #define    PVLONG        1
  176. #define    PVINTEGER    PVLONG
  177. #define    PVFLOAT        2
  178. #define PVCHAR        3
  179. #define PVSTRING    PVCHAR
  180. #define PVKEYWORD    4
  181. #define    PVDEFAULT    5
  182.  
  183. #define    HDFRIS8        0
  184. #define    HDFSDS        1
  185. #define    HDFVSET        2
  186. #define    UNIX        3
  187. #define    DTMPORT        4
  188.  
  189. #define FILEPATH        0
  190. #define VGROUPPATH      1
  191. #define VDATANAME       2
  192.  
  193. #define    OBJECT        (1L<<0)
  194. #define    ATOM        (1L<<1)
  195. #define    INACTIVE    (1L<<2)
  196.  
  197. /* Maxima */
  198. #define    MAXLINELEN    1024
  199. #ifdef __sgi
  200. #define    MAXPATHLEN    256
  201. #endif
  202. #define MAXNAMELEN    100
  203. #define MAXFORMATLEN    200
  204.  
  205. #define MAXVDATAS    20    /* Just to be on the safe side. */
  206. #define MAXACTIONARGS    20    /* DITTO */
  207. #define MAXOBJECTS    20    /* DITTO DITTO */
  208. #define MAXDATADIMS    4    /* Maximum width of a vdata. */
  209.  
  210. /* Constant indexes into the stats records */
  211. #define PX        0    /* X coordinate list */
  212. #define PY        1    /* Y coordinate list */
  213. #define PZ        2    /* Z coordinate list */
  214. #define    MCONNECT    3    /* Connectivity master list */
  215. #define MVSCALAR    4    /* Vertex scalar master values */
  216. #define PCOORD        5    /* Composite coordinate array (PX, PY, PZ) */
  217. #define    VCOLOR        6    /* Pre-scaled vertex color index */
  218. #define    CONNECT        7    /* Active connectivity list */
  219. #define    PICKED        8    /* List of picked things (vertices, edges) */
  220.  
  221. #define UNKNOWN        -1
  222.  
  223. /* Move these kind of constants to static vars within the window create */
  224. #define NTSC_XSIZ       640
  225. #define NTSC_YSIZ       512
  226. #define NTSC_ASPECT     NTSC_XSIZ / NTSC_YSIZ
  227.  
  228. /* Constants for window geometry control. */
  229. #define    AUTO        0
  230. #define    MANUAL        1
  231. #define    PREF        2
  232. #define    PREFALL        PREF
  233. #define    PREFSIZE    4
  234.  
  235. /* COLOR SUPPORT CONSTANTS AND MACROS */
  236. #define    SPEC_BASE    0
  237. #define SPEC_SIZE    256
  238. #define BACKGROUND    0x000000
  239. #define FOREGROUND    0xffffff
  240.  
  241. #define    MAP_COLOR(min,v,max)    (1 + (int) SPEC_BASE + (unsigned int) \
  242.                  ( ((v-min)/(max-min))*(SPEC_SIZE-2) + 0.99) )
  243. #define GRAY_INCREMENT    (((float) 256) / SPEC_SIZE)
  244.  
  245. #define R 0
  246. #define G 1
  247. #define B 2
  248.  
  249. /* Colormap types */
  250. #define    PAL_DEFAULT    PAL_RAINBOW
  251. #define    PAL_RAINBOW    1
  252. #define    PAL_W_TO_B    2
  253. #define    PAL_B_TO_W    3
  254. #define    PAL_RGB        4
  255. #define PAL_ALLYELLOW   5
  256. #define PAL_REDBLUE     6
  257. #define PAL_WHITEBLUE   7
  258. #define PAL_YELLOWRED   8
  259. #define    PAL_MAP        32
  260. #define    PAL_RESET    64
  261. #define    PAL_FILE    128
  262. #define    PAL_HDFFILE    (PAL_FILE | 0)
  263. #define    PAL_RAWFILE    (PAL_FILE | 1)
  264.  
  265. /* gprintf printing commands. */
  266. #define    GPR_LEFTJ    (1<<0)
  267. #define    GPR_CENTERH    (1<<1)
  268. #define    GPR_RIGHTJ    (1<<2)
  269. #define    GPR_TOPJ    (1<<3)
  270. #define    GPR_CENTERV    (1<<4)
  271. #define    GPR_BOTTOMJ    (1<<5)
  272. #define    GPR_UNDERL    (1<<6)
  273.  
  274. /* Status window default location and size */
  275. #define    STATUS_X    30
  276. #define    STATUS_Y    30
  277. #define    STATUS_HEIGHT    20
  278. #define    STATUS_WIDTH    512
  279.  
  280. /* MSG_ defines are types of messages. */
  281. #define MSG_NEWACT    0
  282. #define MSG_NEWFRAME    1
  283. #define MSG_VIEWCHG    2
  284. #define MSG_CLOSING    3
  285. #define MSG_RESET    4
  286. #define MSG_NEWDATA    5
  287. #define    MSG_NEWPICK    6
  288. #define    MSG_REDRAW    7
  289.  
  290.  
  291. /* MACROS */
  292. #ifdef __sgi
  293. #define MIN(a,b)    (((a) < (b)) ? (a) : (b))
  294. #define MAX(a,b)    (((a) > (b)) ? (a) : (b))
  295. #endif
  296. #define ABS(a)        (((a) >= 0) ? (a) : (-(a)))
  297. #define SQR(a)        ((a) * (a))
  298. #define    VALINC(v)    (((v) == NULL) ? 0.0 : *((v)++))
  299. #define    VALOFF(v,o)    (((v) == NULL) ? 0.0 : *(v+o))
  300.  
  301. #if 1
  302. #define PVMALLOC(s)    malloc(s)
  303. #define PVCALLOC(n,t)    ((t *)calloc (n, sizeof(t)))
  304. #define PVNEW(t)    ((t *)calloc (1, sizeof(t)))
  305. #else /* --- HACK HACK HACK HACK! --- */
  306. #define PVMALLOC(s)    malloc(s + s/5)
  307. #define PVCALLOC(n,t)    ((t *)calloc (n, sizeof(t) + sizeof(t)/5))
  308. #define PVNEW(t)    ((t *)calloc (1, sizeof(t) + sizeof(t)/5))
  309. #endif
  310.  
  311. #if 1
  312. /* AUUUUUUUUGHGHGHGGH! */
  313. #define PVFREE(p)    ( ((p) != NULL) && (free(p), (p) = NULL) )
  314. #else
  315. #define PVFREE(p)
  316. #endif
  317.  
  318. #define TRANSaddCommand(s,l)                        \
  319.   do if (s->transcript_fp != NULL) {                    \
  320.     fputs(l, s->transcript_fp);                        \
  321.     if (l[strlen(l)-1] != '\n') putc('\n', s->transcript_fp);        \
  322.   } while (0)
  323.  
  324. #define FOR_EACH_ACTIVE(w,l)    for(w=l->active_windows;w!=NULL;w=NULL)
  325. #define FOR_ALL_WINDOWS(s,w)    for(w=s->windows;w!=NULL;w=WIN_NEXT(w))
  326.  
  327. /* for each frame f which is a member of the window w, do... */
  328. #define FOR_EACH_FRAME(f,i,w)    for(f=WIN_FRAMELIST(w),i=WIN_FRAMES(w);\
  329.                                     i>0;f=FRA_NEXT(f),i--)
  330.  
  331. /* floating-point equality */
  332. #define FEQEPS 0.001
  333. #define FEQABS(x) ((x) < 0.0 ? (-(x)) : (x))
  334. #define FEQ(x,y) (FEQABS(x-y)<FEQEPS ? 1 : 0)
  335.  
  336.  
  337. #define    DEF_PXNAME        "px"
  338. #define    DEF_PYNAME        "py"
  339. #define    DEF_PZNAME        "pz"
  340. #define    DEF_CONNECTNAME        "plist*"
  341. #define    DEF_VSCALARNAME        "scalar"
  342. #define    DEF_VVECTORNAME        "vector"
  343. #define    DEF_GROUPNAME        "/*"
  344.  
  345. #define    WIN_PXNAME(w)        (w->vname[PX])
  346. #define    WIN_PYNAME(w)        (w->vname[PY])
  347. #define    WIN_PZNAME(w)        (w->vname[PZ])
  348. #define    WIN_PLISTNAME(w)    (w->vname[MCONNECT])
  349. #define    WIN_VSCALARNAME(w)    (w->vname[MVSCALAR])
  350.  
  351. #define    WIN_ID(w)        (w->id)
  352. #define    WIN_NAME(w)        (w->name)
  353. #define    WIN_TYPE(w)        (w->type)
  354. #define    WIN_IMAGE(w)        (w->image)
  355. #define    WIN_POLY(w)        ((polyview_t *)WIN_IMAGE(w))
  356. #define    WIN_SOURCE(w)        (w->source)
  357. #define    WIN_SOURCENAME(w)    (WIN_SOURCE(w)?WIN_SOURCE(w)->path:"")
  358. #define    WIN_GROUPNAME(w)    (w->vgroup)
  359. #define    WIN_GROUP(w)        (w->vgroup_ptr)
  360. #define    WIN_INPALETTE(w)    (w->inpalette)
  361. #define    WIN_OUTPALETTE(w)    (w->outpalette)
  362. #define    WIN_RASTERNAME(w)    (w->rastername)
  363. #define    IsRasterContinuous(w)    (w->rastercont)
  364. #define    IsRasterBlastContinuous(w)    (w->rasterblastcont)
  365. #define    WIN_RASTERNUM(w)    (w->rasternum)
  366.  
  367. #define    WIN_INIT_FN(w)        (w->init_fn)
  368. #define    WIN_INIT(w)        (*WIN_INIT_FN(w))
  369. #define WIN_REDRAW_FN(w)    (w->redraw_fn)
  370. #define WIN_REDRAW(w)        (*WIN_REDRAW_FN(w))
  371. #define    WIN_ANIMATE_FN(w)    (w->animate_fn)
  372. #define    WIN_ANIMATE(w)        (*WIN_ANIMATE_FN(w))
  373. #define WIN_NOTIFY_FN(w)    (w->notify_fn)
  374. #define WIN_NOTIFY(w)        (*WIN_NOTIFY_FN(w))
  375. #define    WIN_EVENT_FN(w)        (w->event_fn)
  376. #define    WIN_EVENT(w)        (*WIN_EVENT_FN(w))
  377. #define    WIN_FASTDRAW_FN(w)    (w->fastdraw_fn)
  378. #define    WIN_FASTDRAW(w)        (*WIN_FASTDRAW_FN(w))
  379. #define    WIN_DESTROY_FN(w)    (w->destroy_fn)
  380. #define    WIN_DESTROY(w)        (*WIN_DESTROY_FN(w))
  381.  
  382. #define    WIN_PLSREDRAW(w)    (w->please_redraw)
  383. #define WIN_ANIMATED(w)        (w->animated)
  384. #define    WIN_COUNTDOWN(w)    (w->countdown)
  385. #define    WIN_DELAY(w)        (w->speed)
  386. #define    WIN_SKIP(w)        (w->skip)
  387. #define    WIN_LOCKED(w)        (w->locked)
  388. #define    WIN_FREEZE(w)        (w->freeze)
  389. #define    WIN_X(w)        (w->x)
  390. #define    WIN_Y(w)        (w->y)
  391. #define    WIN_WIDTH(w)        (w->width)
  392. #define    WIN_HEIGHT(w)        (w->height)
  393. #define    WIN_CX(w)        (w->cx)
  394. #define    WIN_CY(w)        (w->cy)
  395. #define    WIN_BITS(w)        (w->bits)
  396. #define    WIN_SHADE(w)        (w->shade)
  397. #define WIN_OUTLINE_COLOR(w)    (w->outline_color)
  398. #define WIN_LIGHT(w)        (w->light)
  399. #define WIN_LIGHT_X(w)        (w->light_x)
  400. #define WIN_LIGHT_Y(w)        (w->light_y)
  401. #define WIN_LIGHT_Z(w)        (w->light_z)
  402. #define WIN_LIGHT_TWOSIDE(w)    (w->light_twoside)
  403. #define    WIN_PALETTE(w)        (w->palette)
  404. #define    WIN_FRAMES(w)        (w->frames)
  405. #define    WIN_FRAMEID(w)        (w->frame_id)
  406. #define    WIN_FRAMELIST(w)    (w->frame_list)
  407. #define    WIN_FRAME(w)        (w->frame)
  408. #define WIN_MAXSELECTED(w)    (OBJ_MAXHITS(WIN_ROOTOBJ(w)))
  409. #define    WIN_SELECTED(w)        (OBJ_HITS(WIN_ROOTOBJ(w)))
  410. #define    WIN_STATS(w,v)        (w->stats[0][v])
  411. #define    WIN_FORWARD(w)        (w->forward)
  412. #define    WIN_REVERSE(w)        (w->reverse)
  413. #define    WIN_NEXT(w)        (w->next)
  414.  
  415. #define WinHasData(w)        (WIN_FRAMELIST(w)&&WIN_ROOTOBJ(w))
  416. #define WinHasNoData(w)        (!WinHasData(w))
  417.  
  418. #define    WIN_ROOTOBJ(w)        (FRA_ROOTOBJ(WIN_FRAMELIST(w)))
  419. #define    WIN_CURROOTOBJ(w)    (FRA_ROOTOBJ(WIN_FRAME(w)))
  420. #define    WIN_ROOTOBJINFO(w)    (w->info)
  421. #define    WIN_DRAW(w)        (WIN_ROOTOBJINFO(w)->draw_fn)
  422. #define    WIN_SCATDRAW(w)        (WIN_ROOTOBJINFO(w)->scatterdraw_fn)
  423. #define    WIN_ROT(w)        (OIN_ROT(WIN_ROOTOBJINFO(w)))
  424. #define    WIN_SCL(w)        (OIN_SCL(WIN_ROOTOBJINFO(w)))
  425. #define    WIN_TRN(w)        (OIN_TRN(WIN_ROOTOBJINFO(w)))
  426.  
  427.  
  428. #define    FRA_NAME(f)        (f->name)
  429. #define    FRA_ROOTOBJ(f)        (f->object)
  430. #define    FRA_PREV(f)        (f->prev)
  431. #define    FRA_NEXT(f)        (f->next)
  432.  
  433.  
  434. #define    OBJ_TYPE(o)        (o->type)
  435. #define    OBJ_NAME(o)        (o->name)
  436. #define    OBJ_INFO(o)        (o->info)
  437. #define    OBJ_REFS(o)        (o->refs)
  438. #define    OBJ_STATS(o,v,d)    (o->stats[d][v])
  439. #define    OBJ_NUMCHILD(o)        (o->u.grp.num)
  440. #define    OBJ_CHILD(o)        (o->u.grp.children)
  441. #define    OBJ_SIBLING(o)        (o->sibling)
  442. #define    OBJ_NUMVERTS(o)        (o->u.obj.nvert)
  443. #define    OBJ_VDATA(o,v)        (o->u.obj.vdata[v])
  444. #define    OBJ_HITS(o)        (OBJ_INFO(o)->hits)
  445. #define    OBJ_MAXHITS(o)        (OBJ_INFO(o)->max_hits)
  446. #define    OBJ_PICKMODE(o)        (OBJ_INFO(o)->pickmode)
  447. #define    OBJ_FIRSTID(o)        (OBJ_INFO(o)->first_element_id)
  448. #define    OBJ_PICKLIST(o)        (OBJ_INFO(o)->picked)
  449. #define    OBJ_PICKLISTSIZE(o)    (OBJ_INFO(o)->size)
  450.  
  451. #define    OIN_REFS(o)        (o->refs)
  452. #define    OIN_ROT(o)        (o->rot)
  453. #define    OIN_SCL(o)        (o->scl)
  454. #define    OIN_TRN(o)        (o->trn)
  455. #define    OIN_DRAW(o)        (*o->draw_fn)
  456. #define    XFO_USED(x)        (x.used)
  457. #define    XFO_COORD(x,c)        (x.coord[c])
  458. #define LON_USED(l)        (l.used)
  459. #define    LON_VALUE(l)        (l.value)
  460.  
  461. #define    VDA_ID(v)        (v->id)
  462. #define    VDA_NAME(v)        (v->name)
  463. #define    VDA_FILE(v)        (v->file)
  464. #define    VDA_LOCKED(v)        (v->locked)
  465. #define    VDA_DATA_IN(v)        (v->in_memory)
  466. #define    VDA_LASTUSED(v)        (v->last_used)
  467. #define    VDA_STATS_IN(v)        (v->stats_read)
  468. #define    VDA_STATS(v)        (v->stats[0])
  469. #define    VDA_DATA(v,t)        ((t *) v->data)
  470. #define    VDA_SIBLING(v)        (v->sibling)
  471. #define    VDA_NEXT(v)        (v->next)
  472.  
  473. #define    VGR_NAME(v)        (v->name)
  474. #define    VGR_ID(v)        (v->id)
  475. #define    VGR_CHILD_IN(v)        (v->children_read)
  476. #define    VGR_FILE(v)        (v->file)
  477. #define    VGR_SIBLING(v)        (v->sibling)
  478. #define    VGR_GROUPS(v)        (v->groups)
  479. #define    VGR_VDATAS(v)        (v->vdatas)
  480.  
  481. #define    WIN_MOVE(w)        (w->move)
  482. #define    WIN_PROJECTION(w)    (w->projection)
  483. #define    WIN_COLORMODE(w)    (w->colormode)
  484. #define WIN_AT(w)        (w->at)
  485. #define    WIN_CFROM(w)        (w->cfrom)
  486. #define    WIN_SFROM(w)        (w->sfrom)
  487. #define    WIN_FOV(w)        (w->view_angle)
  488. #define    WIN_TWIST(w)        (w->twist)
  489. #define    WIN_STEP(w)        (w->step)
  490. #define    WIN_MOVEPATH(w)        (w->movepath)
  491. #define    WIN_MAXWIDTH(w)        (w->max_width)
  492.  
  493. #define    POL_PROBE(p)        (p->probe)
  494. #define    POL_ACTIVES(p)        (p->active_window_thread)
  495.  
  496. #define    POL_OVERLAYS(p)        (p->overlays)
  497. #define    POL_SHADE(p)        (p->shademodel)
  498. #define    POL_RENDER(p)        (p->render)
  499. #define    DEF_FOV            450
  500.  
  501. #define    STA_SOURCES(s)        (s->files)
  502. #define    STA_STATUS(s)        (s->status)
  503. #define    STA_PALETTE(s)        (s->palette_window)
  504. #define    STA_ANIMATE(s)        (s->animate_window)
  505. #define    GetActiveWindow(s)    (s->active_windows)
  506.  
  507. /* pvdata.h includes all typedefs and enums. */
  508. #include "pvdata.h"
  509.  
  510. /* pvproto.h should be automatically generated from 'make proto'. */
  511. #include "pvproto.h"
  512.  
  513. /* pvtokens.h defines unique tokens of range [0x0000, 0xffff] to
  514.    uniquely identify GUI functions. */
  515. #include "pvtokens.h"
  516.  
  517.  
  518. /* Global current state variable used by menu routines. */
  519. /* This is located in pvmain.c and is the only 'global' variable. */
  520. extern state_t *gstate;
  521.  
  522. /* This routine sets the current unlit RGB drawing color,
  523.    given a colorindex entry.  The non-colorindex command
  524.    corresponding to this one is cpack. */
  525. #define PALETTECPACK(col) c3s(gstate->pal[col])
  526.  
  527. #ifndef STREQ
  528. #define STREQ(x,y) (strcmp(x,y) == 0)
  529. #endif
  530.  
  531. #ifdef DEBUG
  532. #define PVD(x) { printf x; fflush (stdout); }
  533. #else
  534. #define PVD(x)
  535. #endif
  536.  
  537. #define PRT(x) { printf x; fflush (stdout); }
  538.  
  539. /* Get rid of asserts for production code. */
  540. /* Will this work? */
  541. #if 0
  542. #ifndef DO_ASSERTS
  543. #define assert(x) x;
  544. #endif
  545. #endif
  546.  
  547. #ifdef DO_AUDIO
  548. #include "aiff.h"
  549. extern int InitSound (void);
  550. extern void PlayAFile (char *);
  551. #define PLAYAFILE(x) \
  552.   if (gstate->use_sound) PlayAFile(x)
  553. #else /* not DO_AUDIO */
  554. #define PLAYAFILE(x)
  555. #endif
  556.  
  557. #endif /* not __POLYVIEW_PV_H__ */
  558.